package br.com.keropizza.dominio;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.validation.constraints.NotNull;

@Entity(name = "pizza")
public class Pizza {

	private Long id;

	private double precoTotal;

	private List<Sabor> sabores = new ArrayList<Sabor>();

	@Id
	@GeneratedValue
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@NotNull(message = "Preço deve ser preenchido.")
	@Column(nullable = false)
	public double getPrecoTotal() {
		return this.precoTotal;
	}

	public void setPrecoTotal(double preco) {
		this.precoTotal = preco;
	}

	@NotNull
	@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	public List<Sabor> getSabores() {
		return this.sabores;
	}

	public void setSabores(List<Sabor> sabores) {
		this.sabores = sabores;
	}

}
